package it.polimi.swimv2.util;

import java.util.StringTokenizer;

/**
 * 
 * Utility class useful to capitalize the first character of a word in a string.<br>
 * e.g. "john brown" --> "John Brown"
 *
 */
public class StringCapitalizer {
	
	public static String  capitalize(String string ){
		String result=string.trim();
		StringTokenizer tk=new StringTokenizer(string);
		StringBuffer sb= new StringBuffer("");
		while(tk.hasMoreTokens()){
			String token=tk.nextToken();
			result=token.substring(0, 1).toUpperCase()+token.substring(1);
			sb.append(result+" ");
		}
		return sb.toString().trim();
		
	}
}
